package example;

import com.jfinal.config.*;
import com.jfinal.core.JFinal;
import com.jfinal.template.Engine;
import top.jwtTokenPlugin.interceptor.AuthInterceptor;
import top.jwtTokenPlugin.plugin.JwtTokenPlugin;

/**
 * 我有故事，你有酒么？
 * JKhaled created by yunqisong@foxmail.com 2017/9/5
 * FOR :
 */
public class MyConfig extends JFinalConfig {

    public static void main (String[] args){
        JFinal.start("src/main/webapp",8080,"/");
    }

    @Override
    public void configConstant(Constants me) {
        me.setDevMode(true);
    }

    @Override
    public void configRoute(Routes me) {
        me.add("/user", UserController.class);
    }

    @Override
    public void configEngine(Engine me) {

    }

    @Override
    public void configPlugin(Plugins me) {
        me.add(new JwtTokenPlugin(UserService.me));                                /**配置权限拦截插件*/
    }

    @Override
    public void configInterceptor(Interceptors me) {
        me.add(new AuthInterceptor());                  // 权限拦截器
    }

    @Override
    public void configHandler(Handlers me) {

    }
}
